package com.example.administrator.androidstudio;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.Window;
import android.widget.Button;

/**
 * Created by Administrator on 2019/3/12.
 */


public class MyDialog extends Dialog {
    Button mBtnOK,mbtnCancel;
    Context mContext;


    public MyDialog(@NonNull Context context) {
        super(context);
        mContext = context;
    }
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout);
        mBtnOK = findViewById(R.id.btn_ok);
        mbtnCancel = findViewById(R.id.btn_cancel);


        mBtnOK.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //点击确定按钮执行代码
                ((MainActivity)mContext).setmTvResult("asdasdasdasd");
                MyDialog.this.dismiss();

            }
        });
    }
}

